/*
 *
 */
package org.jiscinvolve.astrodabis.weaver.registry;

import org.junit.Test;
import org.junit.After;
import org.junit.Before;
import org.junit.runner.RunWith;  

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.w3c.dom.Node;
import org.w3c.dom.Element;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import org.w3c.dom.NamedNodeMap;

import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import java.net.URL;
import java.net.MalformedURLException;

import java.io.FileReader;
import java.io.StringReader;
import java.io.BufferedReader;
import java.io.LineNumberReader;
import java.io.InputStreamReader;
import java.io.IOException;

import java.util.List;
import java.util.ArrayList;

import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.InputStreamRequestEntity;
import org.apache.commons.httpclient.methods.PostMethod;

import org.jiscinvolve.astrodabis.weaver.TestBase;


/**
 *
 * Find and index TAP services.
 *
 * IVOA Registry of Registries
 * http://rofr.ivoa.net/cgi-bin/listSearchables.py
 *
 * NVO
 * http://nvo.stsci.edu/vor10/advancedsearch.aspx#||ddCapList=table%20service
 *
 * AstroGrid
 * http://registry.astrogrid.org/astrogrid-registry/main/index.jsp
 *
 * MSSL
 * http://msslxv.mssl.ucl.ac.uk/astrogrid-registry/
 *
 * EuroVO
 * http://registry.euro-vo.org/search.jsp
 * http://esavo.esa.int/registry/search.jsp
 *
 *
 */
public class RegHarvestTestCase
extends TestBase
    {


    //public static final String endpoint = "http://msslxv.mssl.ucl.ac.uk/astrogrid-registry/xqueryresults.jsp" ;
    public static final String endpoint = "http://registry.astrogrid.org/astrogrid-registry/main/xqueryresults.jsp" ;

    /**
     * Our debug logger.
     * 
     */
    protected static Log log = LogFactory.getLog(RegHarvestTestCase.class);

    @Before
    public void before()
        {
        log.debug("RegHarvestTestCase.before()");
        }

    @After
    public void after()
        {
        log.debug("RegHarvestTestCase.after()");
        }


    @Test
    public void test000()
    throws Exception
        {

        RegistryHarvester harvey = new RegistryHarvester();
        harvey.harvest(
            endpoint
            );

        for(RegistryHarvester.Service service : harvey.services())
            {
            log.debug(
                service
                );            
            }
        }
    }

